
/* Copyright (c) 2012-2015, Daniel Nachbaur <danielnachbaur@gmail.com>
 *                          Stefan.Eilemann@epfl.ch
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License version 2.1 as published
 * by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef EQ_EVENTICOMMAND_H
#define EQ_EVENTICOMMAND_H

#include <co/objectICommand.h> // base class
#include <eq/api.h>
#include <eq/types.h>

namespace eq
{
namespace detail
{
class EventICommand;
}

/**
 * A command specialization for config events.
 *
 * Event commands are generated by Config::sendEvent and arrive in
 * Config::handleEvent(). User data can be extracted with the API provided by
 * co::DataIStream. The user data sent with this command is added while sending
 * the event.
 */
class EventICommand : public co::ObjectICommand
{
public:
    /** @internal */
    // cppcheck-suppress noExplicitConstructor
    EQ_API EventICommand(const co::ICommand& command);

    /** Copy-construct an event command. @version 1.5.1 */
    EQ_API EventICommand(const EventICommand& rhs);

    /** Destruct an event command. @version 1.5.1 */
    EQ_API ~EventICommand();

    /**
     * Returns the event type.
     *
     * The data extracted from this event has to match the data streamed to the
     * EventOCommand by the event's sender. Equalizer events use an event type
     * less than Event::USER. For those events, the data in this command is the
     * eq::Event struct.
     *
     * @return the event type.
     * @version 1.5.1
     */
    EQ_API uint32_t getEventType() const;

private:
    EventICommand();
    EventICommand& operator=(const EventICommand&);
    detail::EventICommand* const _impl;

    void _init();
};

/** Print the event command to the given output stream. @version 1.5.1 */
EQ_API std::ostream& operator<<(std::ostream& os, const EventICommand& command);
}

#endif // EQ_EVENTICOMMAND_H
